#ifndef __SYLAR_UTIL_H__
#define __SYLAR_UTIL_H__

#include <stdio.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/syscall.h>
#include <stdint.h>
#include <unistd.h>
#include <cxxabi.h>
#include <string>
#include <vector>

namespace sylar{

pid_t GetThreadId();

uint64_t GetFiberId();

/**
 * @brief 输出当前的函数栈
 */
void Backtrace(std::vector<std::string>& bt, int size, int skip);	
std::string BacktraceToString(int size = 64, int skip = 2, const std::string& prefix = ""); 

/**
 * @brief 输出类型名
 */
template<class T>
const char* TypeToName() {
    static const char* s_name = abi::__cxa_demangle(typeid(T).name(), nullptr, nullptr, nullptr);
    return s_name;
}

/**
 * @brief 得到当前时间戳
 */
uint64_t GetCurrentMS();
uint64_t GetCurrentUS();

}






#endif